<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>加载中......</h1><input type="button" value="换一个">
    <script src="./jquery-3.5.1.js"></script>
    <script>
        $(function () {

            function xh() {
                $.ajax({

                    type: 'get',
                    url: 'https://autumnfish.cn/api/joke',

                    success: function (mydata) {
                        $('h1').text(mydata)
                    }

                })
            }

            xh()

            $('input').on('click',function(){
                xh()
            })

        })
    </script>
</body>

</html>